package migrations

import (
	"database/sql"

	"gitee.com/sweetsunnyflower/carpooling-server-go/app/models"
	"gitee.com/sweetsunnyflower/carpooling-server-go/pkg/migrate"

	"gorm.io/gorm"
)

func init() {

	type VehicleBrand struct {
		models.BaseModel

		Name    string `gorm:"column:name;comment:车牌品牌名称;" db:"name" json:"name" form:"name"`
		Country string `gorm:"column:country;comment:品牌所属国家;" db:"country" json:"country" form:"country"`
		QueryId uint64 `gorm:"column:query_id;comment:爬取id;" db:"query_id" json:"query_id" form:"query_id"`

		models.CommonTimestampsField
	}

	up := func(migrator gorm.Migrator, DB *sql.DB) {
		migrator.AutoMigrate(&VehicleBrand{})
	}

	down := func(migrator gorm.Migrator, DB *sql.DB) {
		migrator.DropTable(&VehicleBrand{})
	}

	migrate.Add("2023_07_18_111242_add_vehicle_brands_table", up, down)
}
